/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * Portions created by the Initial Developer are
 * Copyright (C) 2012 the Initial Developer.
 * All Rights Reserved.
 *
 * The Original Code is "http://semi-frame.googlecode.com/svn/trenk/".
 *
 * The Initial Developer of the Original Code is the author below.
 */
/**
 * @file MessageQue.h
 * @brief auto generated.
 * @author mornongcloud
 * @date 2012/10/15
 */

#ifndef SEMIIPCMESSAGEQUE_H_
#define SEMIIPCMESSAGEQUE_H_

#include "semi/util/StringUtil.h"
#include "semi/posix/SharedMemory.h"
#include "semi/posix/Semaphore.h"
#include "semi/util/LogUtil.h"

namespace semi {

namespace ipc {

#define BUFFER_SIZE 256

/*
 * MessageQue.h
 *
 *  @author: morningcloud
 */
class MessageQue {
public:
	MessageQue();
	MessageQue(std::string taskid);

	virtual ~MessageQue();

	void init(std::string taskid);
	std::string getQuePath();

	int send(char messsage[], int size);
	int send(std::string message);

	int receive();

	void sweep();
	void terminate();

	void* message;

private:

	std::string TaskId;
	std::string FifoPath;
	//	mmap::CurrentTasks mcrnt;
	//	int size;

	std::string createQuename(std::string taskid);

};

}

}

#endif /* SEMIIPCMESSAGEQUE_H_ */
